home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 276-300 / 299 / rxil / src / check_result.c < prev    next >
C/C++ Source or Header  |  1995-03-14  |  2KB  |  79 lines

  1. /* check_result.c */
  2.  
  3. /*        Copyright © 1989 by Donald T. Meyer, Stormgate Software
  4.  *        All Rights Reserved
  5.  */
  6.  
  7.  
  8.  
  9. #include "rxil.h"
  10.  
  11.  
  12.  
  13. /* NAME
  14.  *        RxilCheckResult
  15.  *
  16.  * SYNOPSIS
  17.  *        RxilCheckResult( rexxmsg );
  18.  *
  19.  *        struct RexxMsg *rexxmsg;
  20.  *
  21.  * FUNCTION
  22.  *        Verify that the secondary result field in a RexxMsg is
  23.  *        appropriatly set.
  24.  *        This should be called for a RexxMsg just prior to replying
  25.  *        it.  This will deal with the case of a result string being
  26.  *        set when the calling program did not request it.
  27.  *        It will be freed, and an error code
  28.  *        set to indicate to the calling program that it should be
  29.  *        requesting a result for this command.
  30.  *
  31.  * INPUTS
  32.  *        rexxmsg = pointer to the RexxMsg structure to be checked.
  33.  *
  34.  * RESULT
  35.  *        None
  36.  *
  37.  * SIDES
  38.  *
  39.  * HISTORY
  40.  *        01-Aug-89    Creation.
  41.  *
  42.  * BUGS
  43.  *
  44.  * SEE ALSO
  45.  *
  46.  */
  47. /* This function will ensure that we have not set a result string
  48.  * to be returned back to ARexx if one was not requested.
  49.  */
  50.  
  51. void RxilCheckResult( struct RexxMsg *rexxmsg )
  52. {
  53.     /* Make sure that we don't return an argstring
  54.      * if one was not requested
  55.      */
  56.     if(  FlagIsSet( rexxmsg->rm_Action, RXFF_RESULT )  )
  57.     {
  58.         /* Result string wanted */
  59.         return;
  60.     }
  61.  
  62.  
  63.     /* A result string was not requested.  Let's see if there is one */
  64.  
  65.     if( (rexxmsg->rm_Result1==0) && (rexxmsg->rm_Result2!=0) )
  66.     {
  67.         /* There is one, so we need to delete it. */
  68.         DeleteArgstring( (struct RexxArg *)(rexxmsg->rm_Result2) );
  69.         rexxmsg->rm_Result2 = 0;
  70.  
  71.         /* Then send an error back to the ARexx program, telling it
  72.          * that it needs to request a result, since this command
  73.          * wants to return one!
  74.          */
  75.         rexxmsg->rm_Result1 = RXERR_REQUIRES_RESULT_FLAG;
  76.     }
  77. }
  78.  
  79.